<?php
/*
 * Created on Feb 11, 2010
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
?>
<?php
require_once APPPATH."models/model_dao.php";
class Model_dao extends Model {

	var $_tbl_name_orginal;
	var $_tbl_name;

	function Model_dao($tbl_name){
		$this->_tbl_name_orginal = $tbl_name;
		$this->_tbl_name = $this->_tbl_name_orginal;
		$CI =& get_instance();
		$language = $CI->config->item("lang_suffix_default");
		$language_current = $_SESSION[LANGUAGE_CURRENT];
		if(strtolower($language)!=strtolower($language_current)){
			$this->_tbl_name .= $CI->config->item('lang_seperator') . $language_current;
		}
	}

	/**
	 *
	 *
	 */
	function setTableName($lang_code){
		$this->_tbl_name = $this->_tbl_name_orginal . "_" . $lang_code;
	}

	/**
	 *
	 *
	 */
	function clone_table($suffix, $copy_content){
		$to_table = $this->_tbl_name_orginal . $suffix;
	    if($this->db->table_exists($to_table)){
			$this->db->drop_table($to_table);
	    }
	    $sql = "CREATE TABLE {$to_table} AS SELECT * FROM {$this->_tbl_name_orginal}";
	    $this->db->query($sql);
	}

	/**
	 *
	 *
	 */
	function clone_record(){

	}
}

?>